package com.cxyzy.fragmentdemo

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        replaceFragment(BlankFragment(), R.id.containerLayout)
    }

    private fun replaceFragment(fragment: Fragment, containerId: Int) =
        supportFragmentManager.beginTransaction().replace(containerId, fragment).commit()
}